﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using University.Workshop.Presenters.WaterPurchase;

namespace University.Workshop.Presentation.WaterPurchase
{
    /// <summary>
    /// Interaction logic for PageSecondStepReadWaterPurchase.xaml
    /// </summary>
    public partial class PageSecondStepReadWaterPurchase : Page, ISecondStepReadWaterPurchase
    {
        PresenterReadWaterPurchase pInternal;
        PresenterReadSecondStep pReadSecondStep;

        public PageSecondStepReadWaterPurchase(PresenterReadWaterPurchase pExternal)
        {
            pInternal = pExternal;
            InitializeComponent();
            pReadSecondStep = new PresenterReadSecondStep(this);
        }

        public void Update()
        {
            pReadSecondStep.UpdateData();
        }

        public void GoNextPage()
        {

        }

        public void GoBackPage()
        {
            pInternal.GoStepOne();
        }

        #region ISecondStepReadWaterPurchase Members

        public DateTime DatePurchase
        {
            set
            {
                DateTime fecha = value;

                DatePurchaseLbl.Content = fecha.ToShortDateString();
            }
        }

        public string Amount
        {
            set
            {
                AmountLbl.Content = value;
            }
        }

        public bool Courtesy
        {
            set
            {
                CourtesyChk.IsHitTestVisible = false;
                CourtesyChk.IsChecked = value;
                if (value)
                    CourtesyChk.Content = "Sí";
                else
                    CourtesyChk.Content = "No";
            }
        }

        public string TotalPrice
        {
            set
            {
                TotalPriceLbl.Content = value;
            }
        }

        #endregion

        #region IReadBasicWaterPurchase Members

        public Model.WaterPurchase WaterPurchaseToRead
        {
            get;
            set;
        }

        #endregion

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            App.Current.MainWindow.Title = "Ver Compra";
        }
    }
}
